package com.qqtech.qquan.circle.model;

import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.qqtech.core.common.enums.YesNoEnum;
import com.qqtech.core.common.util.StringUtil;
import com.qqtech.qquan.circle.enums.CircleTopicBizzTypeDictEnum;
import com.qqtech.qquan.pub.model.PubCommentVo;
import com.qqtech.qquan.user.enums.UserConst;
import com.qqtech.qquan.user.model.UserBase;

@SuppressWarnings("serial")
public class CircleTopicVo extends CircleTopic{
	/**
	 * 荣誉等级
	 */
	private Integer honorLevel;
	/**
	 * 荣誉名称
	 */
	private String honorLevelName;
	
	/**版主名称**/
	private java.lang.String creatorName;

	/**版主头象**/
	private java.lang.String creatorImg;

	/**版主--头衔名称**/
	private java.lang.String creatorGradeName;

	/**是否被当前登录人点过赞;1-是,2-否**/
	private java.lang.Integer isPraised = YesNoEnum.NO.getCode();

	/**是否被当前登录人关注;1-是,2-否**/
	private java.lang.Integer isConcern = YesNoEnum.NO.getCode();
	/**圈子名称**/
	private java.lang.String circleName;
	/**是否显示点赞人列表:1-是,2-否**/
	private java.lang.Boolean isShowPraiseList;
	
	/**点赞人列表--字符串**/
	private java.lang.String praiseUserList;
	/**点赞人列表--UserBase对象列表**/
	private List<UserBase> userList4Praise;
	
	/**话题下的评论**/	
	private List<PubCommentVo> commentList;
	
	/**社区--社区名称**/
	private java.lang.String communityName;
	
	public java.lang.String getCommunityName() {
		return communityName;
	}
	public void setCommunityName(java.lang.String communityName) {
		this.communityName = communityName;
	}
	public java.lang.String getCircleName() {
		return circleName;
	}
	public java.lang.Integer getCommentCont() {
		return this.getCommentCount();
	}
	
	public List<PubCommentVo> getCommentList() {
		return commentList;
	}
	public java.lang.String getCreatorGradeName() {
		return creatorGradeName;
	}
	
	public java.lang.String getCreatorImg() {
		return creatorImg;
	}

	public java.lang.String getCreatorName() {
		return creatorName;
	}

	/**
	 * 版主头像全URL
	 * example: http://192.168.1.xxx:8080/circle/1.png
	 * @return
	 */
	public java.lang.String getFullCreatorImg() {
		if(StringUtil.isBlank(this.getCreatorImg())){
			return "";
		}else if(this.getCreatorImg().indexOf("source://")>-1){
			return this.getCreatorImg();
		} else{
			return super.getImgHandleDomain()+""+this.getCreatorImg()+""+UserConst.IMG_POSTFIX;
		}
	}
	/**
	 * 图片全路径字符串，图片之间用;号隔开
	 * example: http://192.168.1.xxx:8080/circle/topic/1.png;http://192.168.1.xxx:8080/circle/topic/2.png
	 */
	public String getFullImgs() {
	    List<String> imgList = getImgList();
	    String fullImgs = "";
	    for(String oneImg :imgList){
	    	fullImgs += this.getFileDomain()+""+oneImg+";";
	    }
	    if(imgList.size()>0){
	    	return fullImgs.substring(0, fullImgs.length()-1);//去掉最后一个;号
	    }else{
	    	return "";
	    }
	}

	public Integer getHonorLevel() {
		return honorLevel;
	}

	public String getHonorLevelName() {
		return honorLevelName;
	}

	/**
	 * 图片路径集合
	 */
	public List<String> getImgList() {
	    if (StringUtils.isNotBlank(this.getImg())) {
	        Iterator<String> it = Splitter.on(";").trimResults().omitEmptyStrings().split(this.getImg()).iterator();
	        return Lists.newArrayList(it);
	    }
	    return Lists.newArrayList();
	}
	
	public java.lang.Integer getIsConcern() {
		return isConcern;
	}

	public java.lang.Integer getIsPraised() {
		return isPraised;
	}

	/**是否显示评论信息**/
	public boolean getIsShowComment(){
		if(this.getCommentList() != null && this.getCommentList().size() > 0){
			return true;
		}else{
			return false;
		}
	}

	/**是否显示图片**/
	public boolean getIsShowImg(){
		if(StringUtils.isNotBlank(this.getImg())){
			return true;
		}else{
			return false;
		}
	}

	public java.lang.Boolean getIsShowPraiseList() {
		return isShowPraiseList;
	}
	
	/**是否显示投票**/
	public boolean getIsVote(){
		if(null!=getBizzType()&&CircleTopicBizzTypeDictEnum.VOTE.getCode()==getBizzType()){
			return true;
		}else{
			return false;
		}
	}
	
	public java.lang.Integer getPraiseCont() {
		return this.getPraiseCount();
	}
	

	public java.lang.String getPraiseUserList() {
		return praiseUserList;
	}
	public String getTagCn(){
		if(StringUtil.isBlank(this.getTag())){
			return "";
		}else{
			return "【"+this.getTag()+"】";
		}
	}
	public List<UserBase> getUserList4Praise() {
		return userList4Praise;
	}

	public void setCircleName(java.lang.String circleName) {
		this.circleName = circleName;
	}

	public void setCommentList(List<PubCommentVo> commentList) {
		this.commentList = commentList;
	}

	public void setCreatorGradeName(java.lang.String creatorGradeName) {
		this.creatorGradeName = creatorGradeName;
	}

	public void setCreatorImg(java.lang.String creatorImg) {
		this.creatorImg = creatorImg;
	}

	public void setCreatorName(java.lang.String creatorName) {
		this.creatorName = creatorName;
	}
	
	public void setHonorLevel(Integer honorLevel) {
		this.honorLevel = honorLevel;
	}

	public void setHonorLevelName(String honorLevelName) {
		this.honorLevelName = honorLevelName;
	}

	public void setIsConcern(java.lang.Integer isConcern) {
		this.isConcern = isConcern;
	}

	public void setIsPraised(java.lang.Integer isPraised) {
		this.isPraised = isPraised;
	}

	public void setIsShowPraiseList(java.lang.Boolean isShowPraiseList) {
		this.isShowPraiseList = isShowPraiseList;
	}
	
	public void setPraiseUserList(java.lang.String praiseUserList) {
		this.praiseUserList = praiseUserList;
	}

	public void setUserList4Praise(List<UserBase> userList4Praise) {
		this.userList4Praise = userList4Praise;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}
}